package com.onec.service.manage.dto.req;

import com.onec.service.api.content.PatternUtil;
import com.onec.service.api.dto.request.BaseRequest;
import com.onec.service.api.utils.group.manage.Login;
import com.onec.service.api.utils.group.manage.Register;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 用户数据信息dto
 *
 * @author onec
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class UserInfoReq extends BaseRequest {

    private Long id;

    private Integer version;

    @Length(message = "用户名的长度控制在4-16字之间", min = 4, max = 16, groups = {Register.class, Login.class})
    @NotNull(message = "用户名不可为空", groups = {Register.class})
    private String userName;

    private String token;

    /**
     * 机构订单号
     */
    @NotNull(message = "手机号不可为空", groups = {Register.class})
    @Pattern(regexp = PatternUtil.PHONE, message = "手机信息不合法", groups = {Register.class})
    private String phone;

    @Pattern(regexp = PatternUtil.EMAIL, message = "注册邮箱不合法", groups = {Register.class})
    @NotNull(message = "注册邮箱不可为空", groups = {Register.class})
    private String email;


    private String salt;
    @NotNull(message = "请输入登录密码", groups = {Login.class})
    @Pattern(regexp = PatternUtil.PASSWORD_, message = "密码必须为8-16数字和字母组成", groups = {Register.class, Login.class})
    private String password;


    private String userNo;


}
